/**
 * 收缩展开某个DOM
 */
admin.fold = function(id){
  	$('#'+id).slideToggle('fast');
};

/**
 * 处理ajax返回数据之后的刷新操作
 */


admin.ban_com = function(uid){
    if("undefined" == typeof(uid) || uid=='') uid = admin.getChecked();
    if(uid==''){
        ui.error('请选择要禁止的用户');return false;
    }
    for(i=0;i<uid.length;i++){
         $.get(U('bitcoin/Admin/banUser'),{uid:uid[i],f:'com'},function(msg){
        admin.ajaxReload(msg);
    },'json');

    }
};



admin.ban_index = function(uid){
    if("undefined" == typeof(uid) || uid=='') uid = admin.getChecked();
    if(uid==''){
        ui.error('请选择要禁止的用户');return false;
    }
    for(i=0;i<uid.length;i++){
        $.get(U('bitcoin/Admin/banUser'),{uid:uid[i],f:'index'},function(msg){
            admin.ajaxReload(msg);
        },'json');

    }
};


admin.getChecked = function() {
    var ids = new Array();
    $.each($('#list input:checked'), function(i, n){
        if($(n).val() !='0' && $(n).val()!='' ){
            ids.push( $(n).val() );
        }
    });
    return ids;
};


admin.ajaxReload = function(obj,callback){
    if("undefined" == typeof(callback)){
        callback = "location.href = location.href";
    }else{
        callback = 'eval('+callback+')';
    }
    if(obj.status == 1){
        ui.success(obj.data);
        setTimeout(callback,1500);
    }else{
        ui.error(obj.data);
    }
};